//app.js
const config = require('./config.js')
const T = require('./utils/tool.js')
let token = '';
let userId = -1;
let openId = -1;
if (config.env == 'dev' || config.env == 'test') {
  token = "pDmXcblxOpFGKAPPddCn0Q==";
  userId = 14;
  openId = 'ooy0s5IpmIlKsErEP7oVoxbIWrtk'
}
App({
  onLaunch: function () {
    wx.getSystemInfo({
      success: (res) => {
        this.globalData.platform = res.platform;
      }
    })
  },
  onShow: function () {
    this.getIndustryList();
  },
  globalData: {
    platform: '',
    userInfo: {
      companyId:-1,
    },
    industryList: [], // 所属行业
    token: token,
    userId: userId,
    openId:openId,
    config: config,
    T: T,
    role: 1, // 0 管理员  1 超管
  },
  
  getIndustryList() {
    T.req({
      url: config.host + 'web/industry/list',
      method: 'GET',
      success: (res) => {
        let _tem = [];
        res.forEach((m) => {
          _tem.push({
            title: m.name,
            value: m.id
          })
        })
        getApp().globalData.industryList = _tem;
      }
    })
  }
})